<template>
	<view class="page">
		<view class="qrcode">
			<view class="user">
				<view class="img">
					<image :src="caddie_info.head_img" mode="aspectFill"></image>
				</view>
				<view class="username">
					<view>{{caddie_info.user_nickname}}</view>
					<view>(编号：{{caddie_info.invite_code}})</view>
				</view>
			</view>
			<view class="scanCode">扫码预约</view>
			<image class="instructions" src="/static/talent/user/instructions.png"></image>
			<image class="code" :src="qr_code"></image>
			<view class="tx_btn">
				<button open-type="share" :plain="true">立即分享</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				caddie_info: '',
				qr_code: ''
			}
		},
		onShareAppMessage(res) {
		   if (res.from === 'button') {// 来自页面内分享按钮
		     console.log(res.target)
		   }
		   return {
		     title: 'Talent',
		     path: '/pages/index/appointmentNow?id=' + global.userInfo.id + '&invite_code=' + this.caddie_info.invite_code
		   }
		},
		methods: {
			qrcodeInfo() {
				this.$api.post(global.apiUrls.myQrcode, {
					
				}).then(res => {
					console.log(res)
					uni.hideLoading()
					if(res.data.code == 1) {
						this.caddie_info = res.data.data.caddie_info
						this.qr_code = res.data.data.qr_code
						console.log(this.qr_code)
					} else {
						this.$messgae.info(res.data.msg)
					}
				})
			}
		},
		onLoad() {
			uni.showLoading({
				title: '加载中'
			})
		   this.qrcodeInfo()
		   uni.hideShareMenu()
		},
		
	}
</script>

<style lang="scss" scoped>
  .page{
    height: 100vh;
    background-color: #FFFFFF;
	background: url(https://www.goldenbeartalent.com/static/images/3.png) no-repeat;
	background-size: 100% 100%;
	padding: 80rpx 32rpx 0;
	.qrcode {
		background: #FFFFFF;
		border-radius: 16rpx;
		padding: 40rpx 40rpx 70rpx;
		.user {
			display: flex;
			padding-bottom: 32rpx;
			border-bottom: 1rpx solid #f2f2f1;
			.img {
				width: 120rpx;
				height: 120rpx;
				border-radius: 8rpx;
				image {
					width: 100%;
					height: 100%;
					border-radius: 8rpx;
				}
			}
			.username {
				margin-left: 24rpx;
				padding-top: 10rpx;
				view:first-child {
					font-size: 36rpx;
					margin-bottom: 12rpx;
					font-weight: bold;
				}
				view:last-child {
					font-size: 28rpx;
					color: #6B6F73;
				}
			}
		}
		.scanCode {
			font-size: 32rpx;
			color: #009B77;
			text-align: center;
			margin: 48rpx 0 24rpx;
			
		}
		.instructions {
			display: block;
			width: 12rpx;
			height: 8rpx;
			margin: 0 auto 45rpx;
		}
		.code {
			display: block;
			margin: 0 auto 80rpx;
			width: 435rpx;
			height: 435rpx;
		}
		.tx_btn {
			font-size: 32upx;
			color: white;
			line-height: 88upx;
			text-align: center;
			// position: fixed;
			// bottom: 40upx;
			// left: 32upx;
			width: 606rpx;
			height: 88rpx;
			background: #009B77;
			opacity: 1;
			border-radius: 8rpx;
			button {
				width: 606rpx;
				height: 88rpx;
				outline: none;
				background: #009B77;
				color: #FFFFFF;
				border: 1px solid transparent !important;
			}
		}
	}
  }
  
</style>
